<script type="text/javascript" Language="JavaScript">
    <!--
    function Blank_TextField_Validator()
    {
        // Check the value of the element
        // from the form
        if (document.loginform.email.value == ""){
            // If null display and alert box
            alert("Please fill in the e-mail field.");
            // Place the cursor on the field for revision
            document.loginform.email.focus();
            // return false to stop further processing
            return (false);
        }
        if (document.loginform.password.value == ""){
            alert("Please fill in the password field.");
            document.loginform.password.focus();
            return (false);
        }
        // If text_name is not null continue processing
        return (true);
    }
    -->
</script>
<div id="secCol">
<?php
    if (!isset($_SESSION['logged'])) {
?>
    <fieldset id="login">
        <h4>Members login</h4>
        <form method="post" name="loginform" action="?url=logining" onsubmit="return Blank_TextField_Validator()">
            <p class="clearfix">
                <label for="email">E-mail</label>
                <input name="email" id="email" type="text" value="" />
            </p>
            <p class="clearfix">
                <label for="password">Password</label>
                <input name="password" id="password" type="password" value="" />
            </p>
            <p class="clearfix check">
                <input type="checkbox" id="remember" name="remember" />
                <label for="remember" id="remlabel">Remember me</label>
                <input name="submit" id="submit" type="submit" value="" />
            </p>
        </form>
        <p class="member">
            <a href="#">Lost your Password?</a><br />
            Not a member yet? <a href="?url=signup">Register now!</a>
        </p>
    </fieldset>
<?
    }
    $sql = "SELECT `f`.*, `t`.`title` as `type`
            FROM `file` `f`, `type` `t`
            WHERE `f`.`type_id` = `t`.`id`
            ORDER BY `id`
            DESC LIMIT 0, 5;";
    $result = mysql_query($sql, $link);
    if(mysql_num_rows($result)>0) {
?>
    <h3 id="news">Latest News</h3>
    <ul>
<?
        while($row = mysql_fetch_assoc($result)) {
            if (strlen($row['description']) > 60) {
                $strresult = substr($row['description'], 0, 56) . "...";
            } else {
                $strresult = $row['description'];
            }
            $filetype = strtolower($row['type']);
?>
        <li class="clearfix">
            <h4>
                <img src="images/<?= $filetype; ?>.png" title="<?= $row['title']; ?>" width="16px" height="16px" alt="Type" class="image" />
                &nbsp;<?= $row['title']; ?>
            </h4>
                <span><?=$row['date_in']?></span>
            <p><?= $strresult; ?></p>
<?
            if (isset($_SESSION['logged'])) {
?>
            <a href="?url=file&file=<?= $row['id']; ?>">Read more...</a>
<?
            }
?>
        </li>
<?
        }
    }
?>
    </ul>
    <h3 id="test">Company Co.</h3>
    <ul>
        <li class="clearfix">
            <p><b>Las Vegas, NV 12345</b></p>
            <img src="images/contact.jpg" alt="an image" style="margin: 0 auto;display:block;width:95%" />
            <br />
            <p><b>Email:</b> <a href="mailto:info@company.com">info@company.com</a></p>
            <p><b>Phone:</b> (123) 456-7890&nbsp;&nbsp;&nbsp;&nbsp;<b>Fax:</b> (123) 456-7890</p>
        </li>
    </ul>
</div>
<?
    if (!isset($_GET['url']) || $_GET['url'] != "signup") {
?>
<script type="text/javascript" language="javascript">
    document.loginform.email.focus();
</script>
<?
    }
?>
